<template>
    <div class="main">
        <top ref="top" @showlogin="showlogin"></top>
        <div>
            <div class="homtTab">
                <div class="list">
                    <div class="li">
                        <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none"
                            stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"
                            class="tabler-icon tabler-icon-home">
                            <path d="M5 12l-2 0l9 -9l9 9l-2 0"></path>
                            <path d="M5 12v7a2 2 0 0 0 2 2h10a2 2 0 0 0 2 -2v-7"></path>
                            <path d="M9 21v-6a2 2 0 0 1 2 -2h2a2 2 0 0 1 2 2v6"></path>
                        </svg>
                        <span>{{ $t('home.home1') }}</span>
                    </div>
                    <div class="li active">
                        <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none"
                            stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"
                            class="tabler-icon tabler-icon-video">
                            <path
                                d="M15 10l4.553 -2.276a1 1 0 0 1 1.447 .894v6.764a1 1 0 0 1 -1.447 .894l-4.553 -2.276v-4z">
                            </path>
                            <path d="M3 6m0 2a2 2 0 0 1 2 -2h8a2 2 0 0 1 2 2v8a2 2 0 0 1 -2 2h-8a2 2 0 0 1 -2 -2z"></path>
                        </svg>
                        <span>{{ $t('home.home2') }}</span>
                    </div>
                </div>
            </div>

            <div class="videoMain">
                <div class="videoloading" v-show="videoLoading">
                    <svg width="36px" height="36px" viewBox="0 0 38 38" xmlns="http://www.w3.org/2000/svg" stroke="#1971c2"
                        class="mantine-1avyp1d" role="presentation">
                        <g fill="none" fill-rule="evenodd">
                            <g transform="translate(2.5 2.5)" stroke-width="5">
                                <circle stroke-opacity=".5" cx="16" cy="16" r="16"></circle>
                                <path d="M32 16c0-9.94-8.06-16-16-16">
                                    <animateTransform attributeName="transform" type="rotate" from="0 16 16" to="360 16 16"
                                        dur="1s" repeatCount="indefinite"></animateTransform>
                                </path>
                            </g>
                        </g>
                    </svg>
                </div>
                <videolist ref="videolist" v-show="!videoLoading"></videolist>
            </div>
        </div>

        <!-- 底部 -->
        <bottom></bottom>
        <!-- 机器人 -->
        <robot></robot>
    </div>
</template>

<script>
import top from '@/components/top'
import robot from '@/components/robot'
import bottom from '@/components/bottom'
import videolist from '@/components/videolist'
export default {
    name: "home",
    components: {
        top,
        bottom,
        robot,
        videolist

    },
    data() {
        return {
            showLogin: false,
            videoLoading: true
        };
    },
    created() {
        let token = sessionStorage.getItem('token') ? true : false
        this.showLogin = !token
    },
    mounted() {
        setTimeout(() => {
            this.videoLoading = false
        }, 1000)
    },
    methods: {
        showlogin() {
            this.showLogin = true
        },
        loginSuccess() {
            this.showLogin = false
            this.$refs.top.isLogin = true
        }
    },
};
</script>

<style lang="less" scoped>
.homtTab {
    display: flex;
    align-items: center;
    justify-content: space-between;
    outline: 0px;
    -webkit-tap-highlight-color: transparent;
    display: block;
    text-decoration: none;
    color: rgb(193, 194, 197);
    box-sizing: border-box;
    box-shadow: rgba(0, 0, 0, 0.05) 0px 1px 3px, rgba(0, 0, 0, 0.1) 0px 1px 2px;
    position: sticky;
    top: 0px;
    left: 0px;
    z-index: 100;
    border-radius: 0px;
    transition: transform 0.3s ease 0s;
    background: rgb(37, 38, 43);
    margin-bottom: 16px;
    padding: 4px 8px;

    .list {
        background-color: transparent;
        text-align: left;
        text-decoration: none;
        box-sizing: border-box;
        position: relative;
        font-size: 14px;
        white-space: nowrap;
        z-index: 0;
        display: flex;
        align-items: center;
        line-height: 1;
        border-radius: 32px;
        color: rgb(254, 254, 254);

        .li {
            margin-right: 10px;
            display: flex;
            align-items: center;
            border-radius: 32px;
            padding: 8px 16px 8px 10px;
            cursor: pointer;
            position: relative;

            i {
                font-size: 10px;
                height: 18px;
                line-height: 16px;
                text-decoration: none;
                padding: 0px 8px;
                box-sizing: border-box;
                display: inline-flex;
                -webkit-box-align: center;
                align-items: center;
                -webkit-box-pack: center;
                justify-content: center;
                width: auto;
                text-transform: uppercase;
                border-radius: 32px;
                font-weight: 700;
                letter-spacing: 0.25px;
                cursor: inherit;
                text-overflow: ellipsis;
                overflow: hidden;
                background: rgb(240, 140, 0);
                color: rgb(254, 254, 254);
                border: 1px solid transparent;
                margin-left: 4px;
            }
        }

        .active {
            background-color: rgb(55, 58, 64);
        }

        .li:hover {
            background-color: rgb(55, 58, 64);
        }

        svg {
            margin-right: 7px;
        }

        span {
            text-decoration: none;
            font-size: 15px;
            font-weight: 500;
            text-transform: capitalize;
        }
    }
}

.videoloading {
    margin: 30px auto;
    display: block;
    text-align: center;
}</style>
